﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SmartSpace.Orgs
{
    public interface IOrgsService
    {
        #region node
        bool SaveNode(Node node);
        bool DeleteNode(Node node);
        Node GetNode(Guid id, bool isRecursive);
        Node GetNode(string code, bool isRecursive);
        List<Node> GetChildren(Guid id, bool isRecursive);
        List<Node> GetChildren(string code, bool isRecursive);
        #endregion

        #region organization type
        /// <summary>
        /// 保存节点类型
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        ServiceResult SaveType(NodeType type);
        /// <summary>
        /// 删除节点类型
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        ServiceResult DeleteType(NodeType type);
        bool DeleteType(string code);
        bool IncludeSubType(Guid parentTypeId, Guid subTypeId);
        bool RemoveSubType(Guid parentTypeId, Guid subTypeId);
        NodeType GetType(string code);
        /// <summary>
        /// 获取所有的组织结构节点类型
        /// </summary>
        /// <returns></returns>
        ListResult<NodeType> GetTypes();
        /// <summary>
        /// 获取节点类型所包含的子类型
        /// </summary>
        /// <param name="typeId"></param>
        /// <returns></returns>
        ListResult<NodeType> GetSubTypes(Guid typeId);
        #endregion

        #region employee
        ServiceResult SaveEmployee(Employee employee);
        ServiceResult DeleteEmployee(Guid id);
        ServiceResult DeleteEmployee(string code);
        SingleResult<Employee> GetEmployee(Guid id);
        SingleResult<Employee> GetEmployee(string code);
        /// <summary>
        /// 获取属于该角色对应的人员列表
        /// </summary>
        /// <param name="roleIds"></param>
        /// <returns></returns>
        ListResult<Employee> GetEmployees(List<Guid> roleIds);
        /// <summary>
        /// 获取
        /// </summary>
        /// <param name="orgId"></param>
        /// <param name="start"></param>
        /// <param name="limit"></param>
        /// <returns></returns>
        PagedList<Employee> GetEmployees(Guid orgId, int start, int limit);

        /// <summary>
        /// 获取员工列表
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="start"></param>
        /// <param name="limit"></param>
        /// <returns></returns>
        PagedList<Employee> GetEmployees(string filter, int start, int limit);
        #endregion

        #region employee post
        /// <summary>
        /// 分配岗位信息给员工
        /// </summary>
        /// <param name="employeeId"></param>
        /// <param name="orgId"></param>
        /// <param name="isMajor"></param>
        /// <returns></returns>
        ServiceResult AssignPost(Guid employeeId, Guid orgId, bool isMajor);
        /// <summary>
        /// 获取员工的所有岗位信息
        /// </summary>
        /// <param name="employeeId"></param>
        /// <returns></returns>
        List<EmployeePost> GetPosts(Guid employeeId);
        /// <summary>
        /// 获取员工的主岗位信息
        /// </summary>
        /// <param name="employeeId"></param>
        /// <returns></returns>
        EmployeePost GetMajorPost(Guid employeeId);

        #endregion
    }
}
